<?php
/**
  * start.php
  * @param  :
  *
  * @info   : Anzeige des Contents
  *
  * @datum  : 30.12.2010
  * @version: beta
 **/

  session_start();
  error_reporting(E_ALL);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Anmeldung HHEK</title>
<script type="text/javascript">
var getElementsByClassName = function (className, tag, elm){
	if (document.getElementsByClassName) {
		getElementsByClassName = function (className, tag, elm) {
			elm = elm || document;
			var elements = elm.getElementsByClassName(className),
				nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
				returnElements = [],
				current;
			for(var i=0, il=elements.length; i<il; i+=1){
				current = elements[i];
				if(!nodeName || nodeName.test(current.nodeName)) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	else if (document.evaluate) {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
				classesToCheck = "",
				xhtmlNamespace = "http://www.w3.org/1999/xhtml",
				namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
				returnElements = [],
				elements,
				node;
			for(var j=0, jl=classes.length; j<jl; j+=1){
				classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
			}
			try	{
				elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
			}
			catch (e) {
				elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
			}
			while ((node = elements.iterateNext())) {
				returnElements.push(node);
			}
			return returnElements;
		};
	}
	else {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
				classesToCheck = [],
				elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
				current,
				returnElements = [],
				match;
			for(var k=0, kl=classes.length; k<kl; k+=1){
				classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
			}
			for(var l=0, ll=elements.length; l<ll; l+=1){
				current = elements[l];
				match = false;
				for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
					match = classesToCheck[m].test(current.className);
					if (!match) {
						break;
					}
				}
				if (match) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	return getElementsByClassName(className, tag, elm);
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function prepareInputsForHints() {
  var inputs = getElementsByClassName("fieldInfo");
  for (var i=0; i<inputs.length; i++){
    inputs[i].onmouseover = function () {
      this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
    }
    inputs[i].onmouseout = function () {
      this.parentNode.getElementsByTagName("span")[0].style.display = "none";
    }
  }
  var errors = getElementsByClassName("fieldError");
  for (var k=0; k<errors.length; k++){
    errors[k].onmouseover = function () {
      this.parentNode.getElementsByTagName("p")[0].style.display = "inline";
    }
    errors[k].onmouseout = function () {
      this.parentNode.getElementsByTagName("p")[0].style.display = "none";
    }
  }
}
addLoadEvent(prepareInputsForHints);
</script>
    </head>
    <body>
        <?php
        //error_reporting(E_All);
          include('config.inc.php');
          include('classes/controller.php');
          include('classes/model.php');
          include('classes/view.php');

          $request = array_merge($_GET, $_POST);      // $_GET und $_POST zusammenfassen
          $controller = new Controller($request,0);   // Controller erstellen
          echo $controller->display();                // Inhalt der Webanwendung ausgeben.
        ?>
    </body>
</html>
